package com.yang.job.application.convertor;


import com.yang.job.client.dto.YangJobDTO;
import com.yang.job.domain.model.YangJobModel;
import org.springframework.stereotype.Component;

@Component
public class YangJobDTOConvertor {
    public YangJobDTO convert2DTO(YangJobModel yangJobModel) {
        if (yangJobModel == null) {
            return null;
        }
        YangJobDTO yangJobDTO = new YangJobDTO();
        yangJobDTO.setJobId(yangJobModel.getJobId());
        yangJobDTO.setDescription(yangJobModel.getDescription());
        yangJobDTO.setJobName(yangJobModel.getJobName());
        yangJobDTO.setCron(yangJobModel.getCron());
        yangJobDTO.setEnable(yangJobModel.getEnable());
        yangJobDTO.setOpen(yangJobModel.getOpen());
        yangJobDTO.setCreateTime(yangJobModel.getCreateTime());
        yangJobDTO.setUpdateTime(yangJobModel.getUpdateTime());
        yangJobDTO.setFeatureMap(yangJobModel.getFeatureMap());
        yangJobDTO.setExecuteParamMap(yangJobModel.getExecuteParamMap());
        yangJobDTO.setExecuteStrategy(yangJobModel.getExecuteStrategy().getName());
        yangJobDTO.setExecuteClassPath(yangJobModel.getExecuteClassPath());
        return yangJobDTO;
    }
}
